﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="Scripts/jquery-3.3.1.js"></script>
    <style>
        input {
            padding: 3px;
            font-family: inherit;
            border: 1px solid #ff0000; 
        }    
    </style>
</head>
<body>
    文本框1：<input type="text" name="name" value="" />
    文本框2：<input type="text" name="name" value="" />
    文本框3：<input type="text" name="name" value="" />
    <script type="text/javascript">
        $(':text').click(function () {
            changeInputColor("#ddd")
            alert($(':text').val())

        });
        function changeInputColor(color)
        {
            //1.获取所有的Input标签
            var inputs = document.getElementsByTagName("input");
            //2.循环修改对应表达中文字的值
            for (var i = 0; i < inputs.length - 1; i++) {
                if (inputs[i].val != "") {
                    changeTextColor(inputs[i], color)
                }
            }
        }
        function changeTextColor(input,color) {
            input.style.color = color;
        }
    </script>>
</body>
</html>